<template>
  <!-- <div class="tab_box" :style="{ height: tabHeight }"> -->
  <div
    class="title_box"
    :class="item.id == editableTabsValue ? 'title_box_active' : ''"
    @click="handActive(item)"
  >
    <div class="title">{{ item.conditionId }}</div>
    <span
      v-if="item.id == editableTabsValue"
      @click.stop="handDelete(item)"
      style="
        color: #2680d2;
        font-size: 10px;
        margin-left: 6px;
        min-width: 14px;
        height: 14px;
      "
      class="el-icon-close"
    ></span>
  </div>
</template>

<script>
export default {
  inject: ["MTbas"],
  props: {
    item: {
      type: Object,
      default: () => {},
    },
    // editableTabs: {
    //   type: Array,
    //   default: () => [],
    // },
  },
  computed: {
    editableTabs() {
      return this.MTbas.data;
    },
    editableTabsValue() {
      return this.MTbas.value;
    },
  },
  data() {
    return {};
  },
  methods: {
    handDelete(item) {
      this.MTbas.$emit("handTab", "del", item);
      // this.$emit("handDelete", id);
    },

    handActive(item) {
      this.MTbas.$emit("handTab", "click", item);
    },
  },
};
</script>
<style lang="scss" scoped>
.el-icon-close {
  border-radius: 50%;
  /* text-align: center; */
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  /* line-height: 15px; */
  /* vertical-align: middle; */
  display: flex;
  align-items: center;
  justify-content: center;
}
.el-icon-close:hover {
  background-color: #c0c4cc;
  color: #fff !important;
}

.title_box {
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 35px;
  position: relative;
  width: 20%;
  cursor: pointer;
  &::after {
    content: "";
    position: absolute;
    right: 0;
    width: 1px;
    background-color: #e4e4e4;
    height: 14px;
    top: 50%;
    transform: translate(0, -50%);
  }
  .title {
    font-size: 14px;
    color: #707070;
    &:hover {
      color: #2680d2;
    }
    /* margin-right: 6px; */
  }
}
.title_box_active {
  .title {
    color: #2680d2;
  }
  &::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #2680d2;
    height: 2px;
  }
}
.title_box:nth-child(5n) {
  &::after {
    display: none;
  }
}
</style>